/**
 * @Version v1.0
 * @Description: TODO
 * @Author ZHANZHONGXIN
 * @Date 2022/5/7 13:54
 * @Copyright 博为峰
 */
public class ArrayTest01 {
    public static void main(String[] args) {
        //最值
        int[] arr = {10, 21, 9, 11, 26, 6};

        int max = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] > max) {
                max = arr[i];
            }
        }
//        System.out.println("max = " + max);
        int t = 0;
        for (int i = 0; i < arr.length - 1; i++) {//i比较的轮数
            for (int j = 0; j < arr.length - i - 1; j++) {//j每一轮比较的次数
                if (arr[j] > arr[j + 1]) {
                    t = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = t;
                }
            }
        }

        for (int i = 0; i < arr.length; i++) {
            System.out.println("arr[i] = " + arr[i]);
        }

        //工具类Arrays

    }
}
